
class Day2Quarer
    constructor:(end)->
        end = new Date(end)
        month = end.getMonth()+1
        @offset = month%3

    get:(t)->
        month = t.getMonth()+1
        q = parseInt((month+2-@offset)/3)
        year = t.getFullYear()
        if q == 0
            q = 4
            year -= 1
        return "#{year}-0#{q}-01"

module.exports = Day2Quarer
#begin = new Date("2018-11-30")
#date = new Day2Quarer(begin)
#console.log "结束日期", begin.toISOString().slice(0,10)
#
#for i in [11..1]
#    date.get(new Date("2018-#{i}-03"))
